UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8MQ8fM4GDRmazbjpCEDb5q3neWHlcDEQaLn5pwx6Xlo='
WHERE
key_id = '45afbe532b0396017ea68fb6bc2358c61aed3dc746bed8bfe0b8d7366be516fb'
AND (
token = '8MQ8fM4GDRmazbjpCEDb5q3neWHlcDEQaLn5pwx6Xlo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)