UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aoOgy4e6+QWaIs9chGNu7MPNV4Sf1AF+pddxUOjK5MM=' 
WHERE 
  key_id = '427f78e0d7895866ba36f1b95f0650f1a5f176760eabf127fe46948f5c4c28b7' 
  AND (
    token = 'aoOgy4e6+QWaIs9chGNu7MPNV4Sf1AF+pddxUOjK5MM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057