UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4JwVGOiLEGafKfPDBr5pVZApCXK57pjaU955DVa8g6w=' 
WHERE 
  key_id = '3755b69b3f3f7131eba70a2ee137d6be7fb18536d956f8c1af4884ee9c0cbd2b' 
  AND (
    token = '4JwVGOiLEGafKfPDBr5pVZApCXK57pjaU955DVa8g6w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038