UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bp5FUpaAMC+qFHcDU+HvDo015YVC76E7ZtX+KBH4/N0=' 
WHERE 
  key_id = '6b993413d4d933d88c3e23360cc93f419f7071b54b271f277c82df52897ba2f9' 
  AND (
    token = 'Bp5FUpaAMC+qFHcDU+HvDo015YVC76E7ZtX+KBH4/N0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039