UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tBKRtXxqw3YDPAtCT5vwm7o1zxA8+grHujxRNSVJ+N4='
WHERE
key_id = '4d47bd9a891b12942c3c8803659dc55efbd288b98b8afab82120c3a7fef2adc6'
AND (
token = 'tBKRtXxqw3YDPAtCT5vwm7o1zxA8+grHujxRNSVJ+N4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)