UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XL0heCFXpfBwzzzAgULgfnUAcezQEdc2anteWPwp58g=' 
WHERE 
  key_id = 'bb8ce90ec8687a8187297c3da8d8d979ecf3529d489827d36cb3652d060d9c7f' 
  AND (
    token = 'XL0heCFXpfBwzzzAgULgfnUAcezQEdc2anteWPwp58g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033