UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X/wBt21KnoRZEe7U3ZnFt5LXiiU3x09hiH1rCoUTD70='
WHERE
key_id = '3e256e48b3f4d4eea28bf35fa19b2b10b5577a0d361272e4989dedc95786de3a'
AND (
token = 'X/wBt21KnoRZEe7U3ZnFt5LXiiU3x09hiH1rCoUTD70='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)