UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jwa1KlPxe0DtxMZ8CfxmjFPVRYqgGNRtwnbjEDK+UOg='
WHERE
key_id = '3ff9d929be1a95694a9c021c6b728b85948f85d7f8de62090dd61ecf4a725489'
AND (
token = 'jwa1KlPxe0DtxMZ8CfxmjFPVRYqgGNRtwnbjEDK+UOg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)