UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dWT7F/eqDox188aRjudPOxuiHu5Gp/DlqYxCwYDr3qA=' 
WHERE 
  key_id = '563b7ad63f3786fe9e5707e6b839f37dd2ffeb939b49ced8c34e2a40fa3d6635' 
  AND (
    token = 'dWT7F/eqDox188aRjudPOxuiHu5Gp/DlqYxCwYDr3qA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022