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