UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/kKdBs+SgN8WKTC39YYz2qaaAdW7NyY9YEiltUtnsrM='
WHERE
key_id = 'e0d6a7ad45b769dd692edee3a6fbc169d0783a522a7f88812780c79ee4a14dc5'
AND (
token = '/kKdBs+SgN8WKTC39YYz2qaaAdW7NyY9YEiltUtnsrM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)