UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cftUvjPyejTuC/N9ywh+96wD7FFeew/6Lmr1VuA8NqM=' 
WHERE 
  key_id = 'c7b8e0de4a21fd654bcb8e50b269377745ebdbfcd0e99642f462603f424cb808' 
  AND (
    token = 'cftUvjPyejTuC/N9ywh+96wD7FFeew/6Lmr1VuA8NqM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043