UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r9STsZC6tCyYZXTGuY/IRwLqupokQrMAu5ZJWX6n6Co='
WHERE
key_id = 'caee7c8bb68c8da2ba8d43f2d0f81ef63f20e6e037f78c89d42bc1fdce11f3dd'
AND (
token = 'r9STsZC6tCyYZXTGuY/IRwLqupokQrMAu5ZJWX6n6Co='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)