UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+9dg2VTxqXGlngyv7fZNGNwAdrm93il9Ooode3nigCo=' 
WHERE 
  key_id = '57becbc41836cf157221548fa47785a5a44b5de79c14949c3503817f3d794def' 
  AND (
    token = '+9dg2VTxqXGlngyv7fZNGNwAdrm93il9Ooode3nigCo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046