UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yrN4g1Q5edRv4N+qbovVzq/1UNBXny+qjOSg+LJ1TS4='
WHERE
key_id = 'b8b5c00c429ec8cb599e91d37f45a72616a03e0a04fb4d27095c61a6ce03b8a7'
AND (
token = 'yrN4g1Q5edRv4N+qbovVzq/1UNBXny+qjOSg+LJ1TS4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)