UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YX8/s7JouEfdiDVSI23YXHVkvyhRPsoWIXzhEg9GFrA='
WHERE
key_id = '83a6cc90303b3da05b098812581c6c346be72e713b617c8116e2d8b95811bc8e'
AND (
token = 'YX8/s7JouEfdiDVSI23YXHVkvyhRPsoWIXzhEg9GFrA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)