UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KS37Rhsr8f3qvlA2TVchDJVdd+MVzvHlzeWp9h17PkI='
WHERE
key_id = '78a507b1a814195d6692542512175a2b8efe7a13a09e9d5bcd66fddfec741867'
AND (
token = 'KS37Rhsr8f3qvlA2TVchDJVdd+MVzvHlzeWp9h17PkI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)