UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sMlciQBKu2PgH5RL6EC93vu4/ERZHDJwC9CQ3lFILzI=' 
WHERE 
  key_id = '8fcd6512535fc22f428d30d8e90067b678e78590f52006f078780f206d15bd56' 
  AND (
    token = 'sMlciQBKu2PgH5RL6EC93vu4/ERZHDJwC9CQ3lFILzI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031