UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Yj1t6vHKjVuXW4xdDruXzKTn+sQhdO35nWox/gmVhKY=' 
WHERE 
  key_id = '778ea5c6db9a7fd3bd07a6f3ec9364a00b06a35c988962d0c042a5c194e14c9c' 
  AND (
    token = 'Yj1t6vHKjVuXW4xdDruXzKTn+sQhdO35nWox/gmVhKY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039