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