UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6lwh5pWt2N0BtZsB5ZOVq11A+48aQVdE80lpIoeLFo4='
WHERE
key_id = 'a8343bd8189545cccd2fe35e472cc74f4e53c9903e20f93f488fd98c15f83944'
AND (
token = '6lwh5pWt2N0BtZsB5ZOVq11A+48aQVdE80lpIoeLFo4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)