UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7LkQEKbrSXuDc6p0156zdQajTkMTQOgCMX9QCUAv/6Y='
WHERE
key_id = 'fe148eb534d8deafd0820113e72a31d21acb8ba005c2344f5ad54139f8d9d961'
AND (
token = '7LkQEKbrSXuDc6p0156zdQajTkMTQOgCMX9QCUAv/6Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)