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

Query time 0.00043