UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nFZl+A1I8yhiqemv11a0pTkYs0pJphMBmFN6TTOy5Lk='
WHERE
key_id = 'a94da579ad977e505d78b43263feab27041e45bf024a40ead084ec92901ccf31'
AND (
token = 'nFZl+A1I8yhiqemv11a0pTkYs0pJphMBmFN6TTOy5Lk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)