UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IJYM5gZoiyOsLe5klK5OQr7GnjA65qnosexGSu3Byf0='
WHERE
key_id = 'f7db3696a24b9b66307cedb93e2c34f5e3b4cd5011d1193f7b4265292a009230'
AND (
token = 'IJYM5gZoiyOsLe5klK5OQr7GnjA65qnosexGSu3Byf0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)