UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cyGM0hXo/l4tDw/5C4FUq1/1UKqrmVGoAEJmob2lCf8=' 
WHERE 
  key_id = '7db454e6b49c9fff1457826ae945d983b099c127838634ffe65814adb22f45e7' 
  AND (
    token = 'cyGM0hXo/l4tDw/5C4FUq1/1UKqrmVGoAEJmob2lCf8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029