UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wBn/NFCDvvEn/L73HE0E+f2588+dOHszR04IJzwpA98=' 
WHERE 
  key_id = 'b46532d8c4419ef738bcc7616314c3d1a99761334fb528a0309344a9570b9365' 
  AND (
    token = 'wBn/NFCDvvEn/L73HE0E+f2588+dOHszR04IJzwpA98=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023