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