UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r59XJKyhx4WYe8Sf8df4Ey+VPyCFf5+WqCHFmvxGmHQ=' 
WHERE 
  key_id = '8598a2c8bda73fa0f53e4b3c81f6aa6cc3d167a2cbe2ccde9c36f53aceda10fc' 
  AND (
    token = 'r59XJKyhx4WYe8Sf8df4Ey+VPyCFf5+WqCHFmvxGmHQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058