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