UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WEjJCttW5tRLI2CBKwNB/uwblfXS/RNc5J8kGkSJsgw='
WHERE
key_id = 'aad53db084559de6f02d04c69797b77a2aca23b2144929a838c7e28fe8a931bd'
AND (
token = 'WEjJCttW5tRLI2CBKwNB/uwblfXS/RNc5J8kGkSJsgw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)