UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xzy2GmLzJUzgWv5PZHvYUqCxCDzwjJ+hzUyIjKmE8R0=' 
WHERE 
  key_id = '0702874d1fab7406b7dc597a2fdb8bad866b83bf143839bcbd91414d10c1bed7' 
  AND (
    token = 'Xzy2GmLzJUzgWv5PZHvYUqCxCDzwjJ+hzUyIjKmE8R0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032