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