UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q9RdNl+xAy+8lK/1dq04krOKfUloN50bs3rn/2Ubi64=' 
WHERE 
  key_id = 'a9466fe127dde2b1285b95c659f253e516e92d99893c8a0510354fc524871d3d' 
  AND (
    token = 'Q9RdNl+xAy+8lK/1dq04krOKfUloN50bs3rn/2Ubi64=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040