UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v1fLQztYMPIes2bVBlbAqo1caJTg5+S38b+UBmugFNw=' 
WHERE 
  key_id = '290b5bb14b26424d6c70862d8eb25a89026a651e9ae7e5e219db27df0c40bbf3' 
  AND (
    token = 'v1fLQztYMPIes2bVBlbAqo1caJTg5+S38b+UBmugFNw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037