UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5gaIhm2I7WQyXnIGbTXTzKaSIH5LNViRqwZUk+oLrwA='
WHERE
key_id = '1546c8c84f4b1d70ae0b8456b583ebb3e2d86c3341369463ca499340d8cbbe42'
AND (
token = '5gaIhm2I7WQyXnIGbTXTzKaSIH5LNViRqwZUk+oLrwA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)